package de.baumann.browser.views.dialog

import android.content.Context
import android.content.Intent
import android.text.TextUtils
import android.widget.EditText
import android.widget.TextView
import android.widget.Toast
import de.baumann.browser.R
import de.baumann.browser.activitys.user.RetrievePasswordActivity
/**
*@author:
*@date:2019/7/10 16:47
*@discription: 密码输入
*/

@Deprecated("过期")
class PayPasswordDialog(context: Context) : BaseDialog(context) {

    lateinit var inputPayPasswordCallBack:InputPayPasswordCallBack

    override fun laoutId(): Int {
        return R.layout.dialog_pay_dialog
    }

    override fun initView() {
        setCanceledOnTouchOutside(false)
        val edPayPassword = findViewById<EditText>(R.id.edPayPassword)
        findViewById<TextView>(R.id.tvRetrievePassword).setOnClickListener {
            dismiss()
            context.startActivity(Intent(context, RetrievePasswordActivity::class.java))
        }

        findViewById<TextView>(R.id.tvPay).setOnClickListener {
            val password = edPayPassword.text.toString()
            if (TextUtils.isEmpty(password)) {
                Toast.makeText(context, context.getString(R.string.input_password), Toast.LENGTH_SHORT).show()
                return@setOnClickListener
            }
                inputPayPasswordCallBack.inputedPassword(password)
        }
    }

    interface InputPayPasswordCallBack {
        fun inputedPassword(password: String)
    }
}